<?php
/**
 * This class returns an array with the xhtml code of a checkbox and if set an error, info and a title.
 *
 * @author Redouane Benkaddour <redouane@indago.nl>
 * @version 0.5.2
 * @package reform
 * @subpackage checkbox
 */
class checkbox extends input_generator {

    /**
    * Constructor of this class wich need a parameter to set the name attribute of the checkbox.
    *
    * @param string $name
    * @return void
    */
    public function __construct($name){
    	$this->attribute['name'] = $name;
    }
    
    /**
    * This function uses a function to generate the xhtml code of a checkbox and returns the data in an array
    *
    * @return array $component
    */
    public function create(){
    	if($_REQUEST[$this->attribute['name']] == $this->attribute['value']){
    		$this->SetChecked();
    	}

    	$this->component['content'] = $this->generateCode('checkbox');
    	return $this->component;
    }
}
 
?>